package com.balabala.gym_system.swagger.utils;

import cn.hutool.jwt.JWTUtil;
import com.balabala.constant.TokenConstant;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 *
 * @author 何涛
 * @date 2023/4/24 0024
 */

@Slf4j
public class JwtUtils {
    private static final String SECRET= TokenConstant.USER_TOKEN_SECRET;
    public static String getToken(Map<String,Object> map)
    {
        map.put("expire_time",System.currentTimeMillis()+1000*60*60*24);

        return JWTUtil.createToken(map, SECRET.getBytes());
    }
    public static boolean checkToken(String token)
    {
        return JWTUtil.verify(token,SECRET.getBytes());
    }

}
